<script setup>
  import {ref as 响应} from 'vue'
  import 请求 from '@/请求'
  import 串化 from 'qs'

  const 结果 = 响应('初始状态')

  const 获取 = async () => {
    try {
      const 响应 = await 请求.get('/register', {
        params: {page: 2},
        paramsSerializer: 参数 => 串化.stringify(参数)
      })
      结果.value = JSON.stringify(响应.data, null, 2)
    } catch (错误) {
      结果.value = `请求失败: ${错误.message}`
    }
  }

</script>

<template>
  <h1>请求测试</h1>
  <button @click="获取">获取</button>
  <p>{{ 结果 }}</p>
</template>

<style scoped></style>
